package com.coldlz.mmp.proxy;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpVersion;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class HttpRecordRequest implements HttpRecord {
    private String uri;
    @JsonSerialize(using = ToStringSerializer.class)
    private HttpMethod method;
    @JsonSerialize(using = ToStringSerializer.class)
    private HttpVersion httpVersion;
    private HttpHeaders httpHeaders;
    private Map<String, List<String>> headers = new HashMap<>();
    private List<byte[]> content;

    private Integer dbTableId;

    public Integer getDbTableId() {
        return dbTableId;
    }

    public void setDbTableId(Integer dbTableId) {
        this.dbTableId = dbTableId;
    }

    public void addHeader(String key, List<String> value) {
        headers.put(key,value);
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public HttpMethod getMethod() {
        return method;
    }

    public void setMethod(HttpMethod method) {
        this.method = method;
    }

    public HttpVersion getHttpVersion() {
        return httpVersion;
    }

    public void setHttpVersion(HttpVersion httpVersion) {
        this.httpVersion = httpVersion;
    }

    public Map<String, List<String>> getHeaders() {
        return headers;
    }

    public void setHeaders(Map<String, List<String>> headers) {
        this.headers = headers;
    }

    public List<byte[]> getContent() {
        return content;
    }

    public void setContent(List<byte[]> content) {
        this.content = content;
    }

    public HttpHeaders getHttpHeaders() {
        return httpHeaders;
    }

    public void setHttpHeaders(HttpHeaders httpHeaders) {
        this.httpHeaders = httpHeaders;
    }
}
